package com.warehouseprovider.controller;

import entity.ResponseMessage;
import org.apache.log4j.Logger;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import service.ZStockService;

import javax.annotation.Resource;

@Controller
@CrossOrigin
@RequestMapping("/stock")
public class ZStockController {
    private Logger logger=Logger.getLogger(this.getClass());

    @Resource
    private ZStockService zStockService;

    /**
     * 查询库存 条件商品名 pname 仓库 id
     * @param pname
     * @param type
     * @param pageNo
     * @return
     */
    @RequestMapping("/getFyStock")
    @ResponseBody
    public ResponseMessage getFyStock(@RequestParam(required = false)String pname,@RequestParam(required = false) Integer type,@RequestParam int pageNo){
        logger.info("ZStockController stock getFyStock pname:"+pname+",type:"+type+",pageNo:"+pageNo);
        ResponseMessage msg=new ResponseMessage();
        int pageSize =3;
        msg=zStockService.getFyStock(pname,type,pageNo,pageSize);
        return msg;
    }

}
